
//
//  NewSecondYanZhengViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/22.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewBangBankInfoViewController.h"
#import "JTCSM.h"
#import "MyInfoView.h"
static CGFloat myinfoHeight = 50;
@interface NewBangBankInfoViewController ()<UITextFieldDelegate>
{
    NSArray *imageNameArray;
    NSArray *placeholderArray;
    UIView *backView;
    
}
@end

@implementation NewBangBankInfoViewController

- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = NO;
    [self.view setBackgroundColor:RGBACOLOR(241, 241, 241, 1)];
    [df isRemoveTarbar:YES];
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    [self layoutView];
}

- (void)layoutView{
    
    MyInfoView *view2 = [[MyInfoView alloc]initWithFrame:CGRectMake(0, KagainChangeHeight, KCONTROLLERWith, myinfoHeight) imagename:@"绑定银行卡icon.png" title:@"请选择银行卡类型" placeholder:nil isShowLabel:labelType radioBtnIndex:0 GroupId:@""];
    view2.label.frame = CGRectMake(view2.label.LC_x, view2.label.LC_y, KCONTROLLERWith, view2.label.LC_height);
    [self.view addSubview:view2];
    view2.backgroundColor = RGBACOLOR(241, 241, 241, 1);
    
    backView = [[UIView alloc]initWithFrame:CGRectMake(0, myinfoHeight+KagainChangeHeight, self.view.frame.size.width,myinfoHeight*3+10)];
    backView.userInteractionEnabled = YES;
    backView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:backView];
    imageNameArray =@[@"卡类型",@"手机号",@"验证码"];
    placeholderArray=@[@"建设银行（信用卡）",@"请输入银行预留手机号",@"请输入6位验证码"];
    for (int i = 0; i < placeholderArray.count; i++) {
        MyInfoView *view1 = [[MyInfoView alloc]initWithFrame:CGRectMake(0, myinfoHeight*i+(i >1?10:0), KCONTROLLERWith, myinfoHeight) imagename:nil title:imageNameArray[i] placeholder:placeholderArray[i] isShowLabel:RightlabelType radioBtnIndex:0 GroupId:@""];
        if (i == placeholderArray.count-1) {
            CGFloat btnHeight = 30;
            UIButton *getKeyBtn = [UIButton initWithFrame:CGRectMake(KCONTROLLERWith-KBtnWidth-13, view1.LC_y+(myinfoHeight-btnHeight)/2, KBtnWidth-5, btnHeight) backgrandColor:nil titleColor:RGBACOLOR(89, 89, 89, 1 ) title:@"获取验证码" titleFont:12];
            [getKeyBtn addTarget:self action:@selector(getToKey) forControlEvents:UIControlEventTouchUpInside];
            
            [backView addSubview:getKeyBtn];
            [df layerWithView:getKeyBtn radius:15 width:1 color:KZhuTiRGB];
            
        }
        view1.tag = 100+i;
        view1.userInteractionEnabled = YES;
        [backView addSubview:view1];
    }
    NSString *string = @"同意《信用卡还款服务协议》";
    float font = 12;
    CGFloat labelHeight = 30;
    CGRect rect = [df labelHeightWithContent:string height:labelHeight font:font];
    CGFloat btnimagesize = 20;
    CGFloat changesize = 10;
    UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(20, KVIEW_Y(backView)+20, rect.size.width+btnimagesize+changesize, labelHeight);
    [leftButton setImage:[UIImage imageNamed:@"btn_02.png"] forState:UIControlStateNormal];
    [leftButton setImage:[UIImage imageNamed:@"btn_01.png"] forState:UIControlStateSelected];
    
    [leftButton addTarget:self  action:@selector(saveloginInfo:) forControlEvents:UIControlEventTouchUpInside];
    [leftButton setTitle:string forState:UIControlStateNormal];
    [leftButton.titleLabel setFont:[UIFont systemFontOfSize:font]];
    leftButton.imageEdgeInsets = UIEdgeInsetsMake(7.5, 0, 7.5, rect.size.width+changesize);
    //        title的位置大小调整
    leftButton.titleEdgeInsets = UIEdgeInsetsMake(0, -btnimagesize+changesize, 0, 0);
    [leftButton setTitleColor:RGBACOLOR(100, 100, 100, 1) forState:UIControlStateNormal];
    [self.view addSubview:leftButton];
    
    
    UIButton *tijiaobutton = [UIButton buttonWithType:UIButtonTypeCustom];
    tijiaobutton.frame = CGRectMake(25, KVIEW_Y(leftButton)+20, KCONTROLLERWith-40, 50);
    [tijiaobutton addTarget:self action:@selector(tijiao) forControlEvents:UIControlEventTouchUpInside];
    [df layerWithView:tijiaobutton radius:25 width:0 color:nil];
    tijiaobutton.backgroundColor = KZhuTiRGB;
    [tijiaobutton setTitleColor:RGBACOLOR(51, 51, 51, 1) forState:UIControlStateNormal];
    [tijiaobutton setTitle:@"立即绑定" forState:UIControlStateNormal];
    [self.view addSubview:tijiaobutton];
    
}


#pragma mark uitextfieldDelegate
- (void)valueChanged:(UITextField *)textfield{
    
}
- (void)saveloginInfo:(UIButton *)sender{
    
}
- (void)tijiao{
    [self gotoNewShangChuanBankImageViewController];
}

- (void)gotoNewShangChuanBankImageViewController{
    UIViewController *viewCtl = self.navigationController.viewControllers[2];
    [self.navigationController popToViewController:viewCtl animated:YES];
}

- (void)getToKey{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end


